home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2005 October / Gamestar_77_2005-10_dvd.iso / Dema / betonsoldier_spdemo.exe / {app} / Shaders / point_particle.fx < prev    next >
Encoding:
Text File  |  2005-05-05  |  2.2 KB  |  51 lines

  1. //------------------------------------------------------------------------------------------------------
  2. //------------------------------------------------------------------------------------------------------
  3. //------------------------------------------------------------------------------------------------------
  4.  
  5. struct    CVertexShaderInput
  6. {
  7.     float4    Position        :    POSITION;
  8.     float    ParticleSize    :    PSIZE;
  9.     float4    Color            :    COLOR0;
  10. };
  11.  
  12. //------------------------------------------------------------------------------------------------------
  13.  
  14. struct    CVertexShaderOutput
  15. {
  16.     float4    Position        :    POSITION;
  17.     float    ParticleSize    :    PSIZE;
  18.     float4    Color            :    COLOR0;
  19.     float2    ParticleUv        :    TEXCOORD0;
  20. };
  21.  
  22. //------------------------------------------------------------------------------------------------------
  23. //------------------------------------------------------------------------------------------------------
  24. //------------------------------------------------------------------------------------------------------
  25.  
  26. CVertexShaderOutput    PointParticleVSProcess (const CVertexShaderInput input);
  27.  
  28. //------------------------------------------------------------------------------------------------------
  29. //------------------------------------------------------------------------------------------------------
  30. //------------------------------------------------------------------------------------------------------
  31.  
  32. CVertexShaderOutput    PointParticleVSProcess (const CVertexShaderInput input)
  33. {
  34.     CVertexShaderOutput output;
  35.     
  36.     output.Position = mul (input.Position,WorldCameraProjection);
  37.     
  38.     float3 camToPos = input.Position - ObjectLocalCameraPosition;
  39.     float  invCamToPosDistance = rsqrt(camToPos.x * camToPos.x + camToPos.y * camToPos.y + camToPos.z * camToPos.z);
  40.     
  41.     output.ParticleSize = input.ParticleSize * FovResScale * invCamToPosDistance;
  42.     
  43.     output.Color = input.Color;
  44.     output.ParticleUv = (0.0f,0.0f);
  45.         
  46.     return output;
  47. }
  48.  
  49. //------------------------------------------------------------------------------------------------------
  50. //------------------------------------------------------------------------------------------------------
  51. //------------------------------------------------------------------------------------------------------